package com.ssa.server.web;

import com.ssa.server.domain.service.UserService;
import com.ssa.server.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * ytx UserController
 *
 * @author <a href="mailto:chenlsh@ytx.com">陈录顺</a>
 * @since 2.5.12
 */
@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    private UserService userService;

    @GetMapping("/{id}")
    public Object findall(@PathVariable Long id) {
        return userService.findById(id);
    }

    @PostMapping
    public Object save(@RequestBody User user) {
        System.out.println(user);
        return userService.save(user);
    }


}
